﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<!--这meta的作用就是删除默认的苹果工具栏和菜单栏。-->
<meta name="apple-mobile-web-app-capable" content="yes"/>
<!--在web app应用下状态条（屏幕顶部条）的颜色-->
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<!--该标签用于指定是否将网页内容中的手机号码显示为拨号的超链接。-->
<meta name="format-detection" content="telephone=no"/>
<!--网页在任何时候都不能被Cache存储-->
<meta http-equiv="Expires" content="-1"/>
<!--清除缓存-->
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<title></title>
<link href="${ctx}/static/newweb/css/one.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/newweb/css/top.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/newweb/css/footer.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/newweb/css/dropload.css" rel="stylesheet" type="text/css" />
<script src="${ctx}/static/newweb/js/jquery-1.8.0.min.js"></script>
<script language="javascript" type="text/javascript" src="${ctx}/static/newweb/js/dropload.min.js"></script>
<script language="javascript" type="text/javascript">
function home(mid){
	window.location="${ctx}/wechatapi/personal?mid="+mid;
}
</script>
</head>

<body>
<div class="top">搜索结果
</div>
<%
  if (session.member.headimgurl == null){
%>
<img class="topone" src="${ctx}/static/newweb/img/wechat.png" onclick="home('${session.member.id}')"/>
<%
  }else{
%>
<img class="topone" src="${session.member.headimgurl!}46" onclick="home('${session.member.id}')"/>
<%
  }
%>
<div class="navbox">
<ul class="nav">
    <li class="current"> 
     全部
    </li> 
    <li> 
    管理
    </li>
    <li> 
      财务
    </li>
    <li> 
      行政
    </li>
    <li> 
	业务
    
    </li>                 
</ul>
</div>
<div class="topbox"></div>
<div class="viewport">
    <div class="lists" style="display:block;"></div>
    <div class="lists" style="display:none;"></div>
    <div class="lists" style="display:none;"></div>
    <div class="lists" style="display:none;"></div>
    <div class="lists" style="display:none;"></div>
</div>
<div class="bottom"></div>
<div class="footer">
    <a href="${ctx}/wechatapi/portal" class="footerl"><img src="${ctx}/static/newweb/img/zhuye.png" /></a>
    <a href="${ctx}/wechatapi/search" class="footerr"><img src="${ctx}/static/newweb/img/sousuo.png" /></a>
</div>
<div class="fix">
<a href="${ctx}/wechatapi/ask">问</a>
</div>

<script>
$(function(){
    var itemIndex = 0;
    var title1 = encodeURI(encodeURI('${title!}'));
    var tab1LoadEnd = false;
    var tab2LoadEnd = false;
    var tab3LoadEnd = false;
    var tab4LoadEnd = false;
    var tab5LoadEnd = false;
    // tab
    $('li').on('click',function(){
        var $this = $(this);
        itemIndex = $this.index();
	    $("li").removeClass("current");
		$(this).addClass("current");
        $('.lists').eq(itemIndex).show().siblings('.lists').hide();
        if(itemIndex == '0'){
            if(!tab1LoadEnd){
                dropload.unlock();
                dropload.noData(false);
            }else{
                dropload.lock('down');
                dropload.noData();
            }
        }else if(itemIndex == '1'){
            if(!tab2LoadEnd){
                dropload.unlock();
                dropload.noData(false);
            }else{
                dropload.lock('down');
                dropload.noData();
            }
        }else if(itemIndex == '2'){
            if(!tab3LoadEnd){
                dropload.unlock();
                dropload.noData(false);
            }else{
                dropload.lock('down');
                dropload.noData();
            }
        }else if(itemIndex == '3'){
            if(!tab4LoadEnd){
                dropload.unlock();
                dropload.noData(false);
            }else{
                dropload.lock('down');
                dropload.noData();
            }
        }else if(itemIndex == '4'){
            if(!tab5LoadEnd){
                dropload.unlock();
                dropload.noData(false);
            }else{
                dropload.lock('down');
                dropload.noData();
            }
        }
        dropload.resetload();
    });
    var sum1 = 0;var sum2 = 0;var sum3 = 0;var sum4 = 0;var sum5 = 0;
    var counter1 = 0;var counter2 = 0;var counter3 = 0;var counter4 = 0;var counter5 = 0;
    // 每页展示4个
    var num1 = 4;var num2 = 4;var num3 = 4;var num4 = 4;var num5 = 4;
    var pageStart1 = 0,pageEnd1 = 4;var pageStart2 = 0,pageEnd2 = 4;var pageStart3 = 0,pageEnd3 = 4;
    var pageStart4 = 0,pageEnd4 = 4;var pageStart5 = 0,pageEnd5 = 4;
    // dropload
    var dropload = $('.viewport').dropload({
        scrollArea : window,
        domDown : {
            domClass   : 'dropload-down',
            domRefresh : '<div class="dropload-refresh">↓下拉加载更多</div>',
            domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
            domNoData  : '<div class="dropload-noData">加载完毕</div>'
        },
        loadDownFn : function(me){
            // 加载菜单一的数据
            if(itemIndex == '0'){
                $.ajax({
                    type: 'GET',
                    url: '${ctx}/wechatapi/ajaxdosearch?title='+title1+'&type=0&pageCurrent='+(counter1+1),
                    dataType: 'json',
                    success: function(data){
                            var result = '';
                            counter1++;
                            for(var i = pageStart1; i < pageEnd1; i++){
                            	if (i <= data.pageData.length-1){
                            		sum1++;
                            		var iurl = "";
                            		if (data.pageData[i].img == null){
                            			iurl="${ctx}/static/newweb/img/wechat.png";
                            		}else{
                            			iurl=data.pageData[i].img+'46';
                            		}
                            		var type = 0;
                            		if (data.pageData[i].typeid == 1){
                            			type = "管理";
                            		}else if (data.pageData[i].typeid == 2){
                            			type = "财务";
                            		}else if (data.pageData[i].typeid == 3){
                            			type = "行政";
                            		}else if (data.pageData[i].typeid == 4){
                            			type = "业务";
                            		}else if (data.pageData[i].typeid == 0){
                            			type = "未知";
                            		}
                            		var title="";
                            		if (data.pageData[i].title!=null){
                            			if (data.pageData[i].title.length>=30){
                            				title=data.pageData[i].title.substring(0 , 30);
                            				title +='......';
                            			}else{
                            				title=data.pageData[i].title;
                            			}                           			
                            		}
                            		var content="";
                            		if (data.pageData[i].content!=null){
                            			if (data.pageData[i].content.length>=60){
                            				content=data.pageData[i].content.substring(0 , 60);
                            				content +='......';
                            			}else{
                            				content=data.pageData[i].content;
                            			}                           			
                            		}
                            		content = content.replace('\n','<br/>');
                            		result +='<div class="main"><div class="gr"><img src="'+iurl+'" onclick="home(\''+data.pageData[i].mid+'\');"/>'
                            		       +'<span>来自'+type+'</span></div><div class="gn">'
                            		       +'<img src="${ctx}/static/newweb/img/guanzhu.png"/><span>'+data.pageData[i].follow+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/pinglun.png"/><span>'+data.pageData[i].replys+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/dianzan.png"/><span>'+data.pageData[i].praise+'</span></div>'
                            		       +'<h1  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+title+'</h1>'
                            		       +'<p  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+content+'</p></div>';                        		
                            	}
                                if(sum1 == data.totalRow){
                                	counter1 = counter1-1;
                                	tab1LoadEnd=true;
                                    // 锁定
                                    me.lock();
                                    // 无数据
                                    me.noData();
                                    break;
                                }
                            }
                            // 为了测试，延迟1秒加载
                            setTimeout(function(){
                            	$('.lists').eq(itemIndex).append(result);
                                // 每次数据加载完，必须重置
                                me.resetload();
                                if (sum1==0){
                                	$('.dropload-noData').html('没有找到与"${title!}"相关的问题');
                                }
                            },100);                         
                    },
                    error: function(xhr, type){
                        alert('Ajax error!');
                        // 即使加载出错，也得重置
                        me.resetload();
                    }
                });
            // 加载菜单二的数据
            }else if(itemIndex == '1'){
                $.ajax({
                    type: 'GET',
                    url: '${ctx}/wechatapi/ajaxdosearch?title='+title1+'&type=1&pageCurrent='+(counter2+1),
                    dataType: 'json',
                    success: function(data){
                            var result = '';
                            counter2++;
                            for(var i = pageStart2; i < pageEnd2; i++){
                            	if (i <= data.pageData.length-1){
                            		sum2++;
                            		var iurl = "";
                            		if (data.pageData[i].img == null){
                            			iurl="${ctx}/static/newweb/img/wechat.png";
                            		}else{
                            			iurl=data.pageData[i].img+'46';
                            		}
                            		var type = 0;
                            		if (data.pageData[i].typeid == 1){
                            			type = "管理";
                            		}else if (data.pageData[i].typeid == 2){
                            			type = "财务";
                            		}else if (data.pageData[i].typeid == 3){
                            			type = "行政";
                            		}else if (data.pageData[i].typeid == 4){
                            			type = "业务";
                            		}else if (data.pageData[i].typeid == 0){
                            			type = "未知";
                            		}
                            		var title="";
                            		if (data.pageData[i].title!=null){
                            			if (data.pageData[i].title.length>=30){
                            				title=data.pageData[i].title.substring(0 , 30);
                            				title +='......';
                            			}else{
                            				title=data.pageData[i].title;
                            			}                           			
                            		}
                            		var content="";
                            		if (data.pageData[i].content!=null){
                            			if (data.pageData[i].content.length>=60){
                            				content=data.pageData[i].content.substring(0 , 60);
                            				content +='......';
                            			}else{
                            				content=data.pageData[i].content;
                            			}                           			
                            		}
                            		content = content.replace('\n','<br/>');
                            		result +='<div class="main"><div class="gr"><img src="'+iurl+'" onclick="home(\''+data.pageData[i].mid+'\');"/>'
                            		       +'<span>来自'+type+'</span></div><div class="gn">'
                            		       +'<img src="${ctx}/static/newweb/img/guanzhu.png"/><span>'+data.pageData[i].follow+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/pinglun.png"/><span>'+data.pageData[i].replys+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/dianzan.png"/><span>'+data.pageData[i].praise+'</span></div>'
                            		       +'<h1  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+title+'</h1>'
                            		       +'<p  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+content+'</p></div>';                        		
                            	}
                                if(sum2 == data.totalRow){
                                	counter2 = counter2-1;
                                	tab2LoadEnd=true;
                                    // 锁定
                                    me.lock();
                                    // 无数据
                                    me.noData();
                                    break;
                                }
                            }
                            // 为了测试，延迟1秒加载
                            setTimeout(function(){
                            	$('.lists').eq(itemIndex).append(result);
                                // 每次数据加载完，必须重置
                                me.resetload();
                                if (sum2==0){
                                	$('.dropload-noData').html('没有找到与"${title!}"相关的问题');
                                }
                            },100);                         
                    },
                    error: function(xhr, type){
                        alert('Ajax error!');
                        // 即使加载出错，也得重置
                        me.resetload();
                    }
                });            	
            }else if(itemIndex == '2'){
                $.ajax({
                    type: 'GET',
                    url: '${ctx}/wechatapi/ajaxdosearch?title='+title1+'&type=2&pageCurrent='+(counter3+1),
                    dataType: 'json',
                    success: function(data){
                            var result = '';
                            counter3++;
                            for(var i = pageStart3; i < pageEnd3; i++){
                            	if (i <= data.pageData.length-1){
                            		sum3++;
                            		var iurl = "";
                            		if (data.pageData[i].img == null){
                            			iurl="${ctx}/static/newweb/img/wechat.png";
                            		}else{
                            			iurl=data.pageData[i].img+'46';
                            		}
                            		var type = 0;
                            		if (data.pageData[i].typeid == 1){
                            			type = "管理";
                            		}else if (data.pageData[i].typeid == 2){
                            			type = "财务";
                            		}else if (data.pageData[i].typeid == 3){
                            			type = "行政";
                            		}else if (data.pageData[i].typeid == 4){
                            			type = "业务";
                            		}else if (data.pageData[i].typeid == 0){
                            			type = "未知";
                            		}
                            		var title="";
                            		if (data.pageData[i].title!=null){
                            			if (data.pageData[i].title.length>=30){
                            				title=data.pageData[i].title.substring(0 , 30);
                            				title +='......';
                            			}else{
                            				title=data.pageData[i].title;
                            			}                           			
                            		}
                            		var content="";
                            		if (data.pageData[i].content!=null){
                            			if (data.pageData[i].content.length>=60){
                            				content=data.pageData[i].content.substring(0 , 60);
                            				content +='......';
                            			}else{
                            				content=data.pageData[i].content;
                            			}                           			
                            		}
                            		content = content.replace('\n','<br/>');
                            		result +='<div class="main"><div class="gr"><img src="'+iurl+'" onclick="home(\''+data.pageData[i].mid+'\');"/>'
                            		       +'<span>来自'+type+'</span></div><div class="gn">'
                            		       +'<img src="${ctx}/static/newweb/img/guanzhu.png"/><span>'+data.pageData[i].follow+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/pinglun.png"/><span>'+data.pageData[i].replys+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/dianzan.png"/><span>'+data.pageData[i].praise+'</span></div>'
                            		       +'<h1  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+title+'</h1>'
                            		       +'<p  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+content+'</p></div>';                        		
                            	}
                                if(sum3 == data.totalRow){
                                	counter3 = counter3-1;
                                	tab3LoadEnd=true;
                                    // 锁定
                                    me.lock();
                                    // 无数据
                                    me.noData();
                                    break;
                                }
                            }
                            // 为了测试，延迟1秒加载
                            setTimeout(function(){
                            	$('.lists').eq(itemIndex).append(result);
                                // 每次数据加载完，必须重置
                                me.resetload();
                                if (sum3==0){
                                	$('.dropload-noData').html('没有找到与"${title!}"相关的问题');
                                }
                            },100);                         
                    },
                    error: function(xhr, type){
                        alert('Ajax error!');
                        // 即使加载出错，也得重置
                        me.resetload();
                    }
                });            	
            }else if(itemIndex == '3'){
                $.ajax({
                    type: 'GET',
                    url: '${ctx}/wechatapi/ajaxdosearch?title='+title1+'&type=3&pageCurrent='+(counter4+1),
                    dataType: 'json',
                    success: function(data){
                            var result = '';
                            counter4++;
                            for(var i = pageStart4; i < pageEnd4; i++){
                            	if (i <= data.pageData.length-1){
                            		sum4++;
                            		var iurl = "";
                            		if (data.pageData[i].img == null){
                            			iurl="${ctx}/static/newweb/img/wechat.png";
                            		}else{
                            			iurl=data.pageData[i].img+'46';
                            		}
                            		var type = 0;
                            		if (data.pageData[i].typeid == 1){
                            			type = "管理";
                            		}else if (data.pageData[i].typeid == 2){
                            			type = "财务";
                            		}else if (data.pageData[i].typeid == 3){
                            			type = "行政";
                            		}else if (data.pageData[i].typeid == 4){
                            			type = "业务";
                            		}else if (data.pageData[i].typeid == 0){
                            			type = "未知";
                            		}
                            		var title="";
                            		if (data.pageData[i].title!=null){
                            			if (data.pageData[i].title.length>=30){
                            				title=data.pageData[i].title.substring(0 , 30);
                            				title +='......';
                            			}else{
                            				title=data.pageData[i].title;
                            			}                           			
                            		}
                            		var content="";
                            		if (data.pageData[i].content!=null){
                            			if (data.pageData[i].content.length>=60){
                            				content=data.pageData[i].content.substring(0 , 60);
                            				content +='......';
                            			}else{
                            				content=data.pageData[i].content;
                            			}                           			
                            		}
                            		content = content.replace('\n','<br/>');
                            		result +='<div class="main"><div class="gr"><img src="'+iurl+'" onclick="home(\''+data.pageData[i].mid+'\');"/>'
                            		       +'<span>来自'+type+'</span></div><div class="gn">'
                            		       +'<img src="${ctx}/static/newweb/img/guanzhu.png"/><span>'+data.pageData[i].follow+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/pinglun.png"/><span>'+data.pageData[i].replys+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/dianzan.png"/><span>'+data.pageData[i].praise+'</span></div>'
                            		       +'<h1  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+title+'</h1>'
                            		       +'<p  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+content+'</p></div>';                        		
                            	}
                                if(sum4 == data.totalRow){
                                	counter4 = counter4-1;
                                	tab4LoadEnd=true;
                                    // 锁定
                                    me.lock();
                                    // 无数据
                                    me.noData();
                                    break;
                                }
                            }
                            // 为了测试，延迟1秒加载
                            setTimeout(function(){
                            	$('.lists').eq(itemIndex).append(result);
                                // 每次数据加载完，必须重置
                                me.resetload();
                                if (sum4==0){
                                	$('.dropload-noData').html('没有找到与"${title!}"相关的问题');
                                }
                            },100);                         
                    },
                    error: function(xhr, type){
                        alert('Ajax error!');
                        // 即使加载出错，也得重置
                        me.resetload();
                    }
                });            	
            }else if(itemIndex == '4'){
                $.ajax({
                    type: 'GET',
                    url: '${ctx}/wechatapi/ajaxdosearch?title='+title1+'&type=4&pageCurrent='+(counter5+1),
                    dataType: 'json',
                    success: function(data){
                            var result = '';
                            counter5++;
                            for(var i = pageStart5; i < pageEnd5; i++){
                            	if (i <= data.pageData.length-1){
                            		sum5++;
                            		var iurl = "";
                            		if (data.pageData[i].img == null){
                            			iurl="${ctx}/static/newweb/img/wechat.png";
                            		}else{
                            			iurl=data.pageData[i].img+'46';
                            		}
                            		var type = 0;
                            		if (data.pageData[i].typeid == 1){
                            			type = "管理";
                            		}else if (data.pageData[i].typeid == 2){
                            			type = "财务";
                            		}else if (data.pageData[i].typeid == 3){
                            			type = "行政";
                            		}else if (data.pageData[i].typeid == 4){
                            			type = "业务";
                            		}else if (data.pageData[i].typeid == 0){
                            			type = "未知";
                            		}
                            		var title="";
                            		if (data.pageData[i].title!=null){
                            			if (data.pageData[i].title.length>=30){
                            				title=data.pageData[i].title.substring(0 , 30);
                            				title +='......';
                            			}else{
                            				title=data.pageData[i].title;
                            			}                           			
                            		}
                            		var content="";
                            		if (data.pageData[i].content!=null){
                            			if (data.pageData[i].content.length>=60){
                            				content=data.pageData[i].content.substring(0 , 60);
                            				content +='......';
                            			}else{
                            				content=data.pageData[i].content;
                            			}                           			
                            		}
                            		content = content.replace('\n','<br/>');
                            		result +='<div class="main"><div class="gr"><img src="'+iurl+'" onclick="home(\''+data.pageData[i].mid+'\');"/>'
                            		       +'<span>来自'+type+'</span></div><div class="gn">'
                            		       +'<img src="${ctx}/static/newweb/img/guanzhu.png"/><span>'+data.pageData[i].follow+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/pinglun.png"/><span>'+data.pageData[i].replys+'</span>'
                            		       +'<img src="${ctx}/static/newweb/img/dianzan.png"/><span>'+data.pageData[i].praise+'</span></div>'
                            		       +'<h1  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+title+'</h1>'
                            		       +'<p  onclick="window.location=\'${ctx}/wechatapi/detail?id='+data.pageData[i].id+'\'">'+content+'</p></div>';                       		
                            	}
                                if(sum5 == data.totalRow){
                                	counter5 = counter5-1;
                                	tab5LoadEnd=true;
                                    // 锁定
                                    me.lock();
                                    // 无数据
                                    me.noData();
                                    break;
                                }
                            }
                            // 为了测试，延迟1秒加载
                            setTimeout(function(){
                            	$('.lists').eq(itemIndex).append(result);
                                // 每次数据加载完，必须重置
                                me.resetload();
                                if (sum5==0){
                                	$('.dropload-noData').html('没有找到与"${title!}"相关的问题');
                                }
                            },100);                         
                    },
                    error: function(xhr, type){
                        alert('Ajax error!');
                        // 即使加载出错，也得重置
                        me.resetload();
                    }
                });            	
            }
        }
    });	
});
</script>
</body>
</html>
